package DIV;

public class Solution {
    private int multiply(int A,int B){
        return f(A,B);
    }
    private int f(int A,int B) {
        if(B == 1) return A;
        int t = get(B);
        A = (A<<t); // 相当于*2^n
        return A + f(A>>t,B-(1<<t));
    }
    private int get(int x){
        int ans = 0;
        while ((1<<(ans+1))<x){
            ans++;
        }
        return ans;
    }
}
